/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package attendance.web.servlets;

import attendance.libs.Attendance;
import attendance.libs.AttendanceImplDb;
import java.io.IOException;
import java.util.ResourceBundle;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author papi
 */
public class SeminarList extends HttpServlet {


    /**
     *          It shows seminar list.
     *
     * @param   request
     * @param   response
     * @throws  javax.servlet.ServletException
     * @throws  java.io.IOException
     */
    private void show(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        ResourceBundle text = ResourceBundle.getBundle("attendance.web.data.WebLang");

        Attendance attendance = new AttendanceImplDb();

        // Show data.
        request.setAttribute("seminars", attendance.getSeminars());
        request.setAttribute("pageTitle", text.getString("SEMINAR_LIST"));
        request.setAttribute("tableHeader", new String[]{
            text.getString("SUBJECT_CODE"),
            text.getString("SUBJECT_NAME"),
            text.getString("SEMINAR_NUMBER")
        });
        request.getRequestDispatcher("/seminarList.jsp").forward(request, response);

    }


    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        show(request, response);
        
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        show(request, response);

    }
}
